﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Organizer
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            try
            {
                BLOrganizer.BLUsers BL = new BLOrganizer.BLUsers();
                int UserId = BL.GetUser(username.Value, password.Value);
                if (UserId != 0)
                {
                    Response.RedirectToRoute("Main", new { UserId = UserId });
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "validation", "alert('" + ex.Message.ToString() + "');", true);
            }
        }
    }
}